/*
 * @Author         : zhanglk
 * @Date           : 2020-06-04 13:57:18
 * @LastEditTime   : 2020-06-09 11:39:50
 * @LastEditors    : zhanglk
 * @Description    :
 * @FilePath       : \jiaparts-jsj\src\utils\toast.ts
 */
// import Taro from '@tarojs/taro';
// import "@/static/images/success.png";
// import "@/static/images/error.png";
// import "@/static/images/warning.png"
const Toast = { 
  //错误提示
  error(title: string, options?: any) {
    return uni.showToast({ 
      title: title,
      // icon: 'warn',
      image: '/static/images/error.png',
      mask:true,
      ...options,
    });
  },
  //成功提示
  success(title: string, options?: any) {
    return uni.showToast({
      title: title,
      icon: 'success',
      image: '/static/images/success.png',
      mask:true,
      ...options,
    });
  },
  //普通消息提示
  message(title: string, options?: any) {
    return uni.showToast({
      title: title,
      icon: 'none',
      mask:true,
      ...options,
    });
  },
  //警告提示
  warn(title: string, options?: any) {
    return uni.showToast({
      title: title,
      // icon: 'warn',
      image: '/static/images/warning.png',
      mask:true,
      ...options,
    });
  },
  //隐藏提示框
  hideToast() {
    return uni.hideToast();
  },
  //显示loading
  showLoading(title?: string, options?: any) {
    return uni.showLoading({
      title: title || '加载中...',
      mask:true,
      ...options,
    });
  },
  //取消loading
  hideLoading() {
    return uni.hideLoading();
  },
};

export default Toast;
